#pragma once

#include <torch/torch.h>
#include <LibDL/utils.h>

//#if defined (SWIG)
//%ignore Dtype _get_dty(const std::string & dty);
//#else
//Dtype _get_dty(const std::string & dty);
//#endif

struct Dtype {
	using core_type = torch::Dtype ;
	core_type core;
    ENABLE_CAST;
#if defined(SWIG)
	
	%proxycode %{
		public static Dtype INT8 = get_dty("I8");
		public static Dtype INT16 = get_dty("I16");
		public static Dtype INT32 = get_dty("I32");
		public static Dtype INT64 = get_dty("I64");
		public static Dtype FLOAT16 = get_dty("F16");
		public static Dtype FLOAT32 = get_dty("F32");
		public static Dtype FLOAT64 = get_dty("F64");
	%}
	
	%javamethodmodifiers Dtype::get_dty      "private";

#endif

public:
    static Dtype get_dty(const std::string & dty);
    
	//For swig
	Dtype() :core(torch::kFloat32){};

	Dtype(core_type c) :core(c) {}

    std::string toString() {
        std::stringstream ss;
        ss << core;
        return ss.str();
    }
};